﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using DomainModel;
using DomainModel.Entities;
using RemoteFacade.Models;
using RemoteFacade.Adapters;

namespace RemoteFacade
{
    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = false)]
    public class UserService : IUserService
    {
        private IUserAdapter adapter;

        public UserService(IUserAdapter adapter)
        {
            this.adapter = adapter;
        }

        public IList<UserModel> GetAllUsers()
        {
            return NHSessionProvider.Session.QueryOver<User>().List<User>().Select(adapter.MapToModel).ToList();
        }
    }
}
